package com.atguigu.jinx.controller;

import com.atguigu.jinx.entity.vo.PayAsyncVo;
import com.atguigu.jinx.service.IRechargeOrderService;
import com.google.gson.Gson;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author steve
 * @since 2025-08-07
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/pay")
public class PaymentNotifyController {


    private final IRechargeOrderService rechargeOrderService;


    @PostMapping("/alipay/notify")
    @SneakyThrows
    public String alipayNotify(PayAsyncVo payAsyncVo, HttpServletResponse response) {
        return rechargeOrderService.dealNotify(payAsyncVo,response);
    }

    @GetMapping("/test/return")
    public String testReturn(HttpServletRequest request, HttpServletResponse response) {
        return "成功接收2";
    }

}
